package com.matt.sooncleaner.junk

import android.content.Context
import android.view.ViewGroup
import com.chad.library.adapter4.BaseQuickAdapter
import com.chad.library.adapter4.viewholder.QuickViewHolder
import com.matt.sooncleaner.R

class JunkAdapter(items: List<JunkBean>) : BaseQuickAdapter<JunkBean, QuickViewHolder>(items) {
    override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: JunkBean?) {
        item ?: return
        holder.setText(R.id.junk_name, item.name)
        holder.setText(R.id.junk_size, SizeUtil.formatSize3(item.size))
    }

    override fun onCreateViewHolder(
        context: Context,
        parent: ViewGroup,
        viewType: Int
    ): QuickViewHolder {
        return QuickViewHolder(R.layout.junk_list_item, parent)
    }
}